<template>
  <div class="app">
    <div v-if="vis3">
      <a-breadcrumb style="margin-bottom: 10px">
        <a-breadcrumb-item>遗产监测平台</a-breadcrumb-item>
        <a-breadcrumb-item>遗产监测任务</a-breadcrumb-item>
      </a-breadcrumb>
      <a-row>
        <a-col :span="6">
          监测任务名称：
          <a-input placeholder="请输入" v-model="query.inspectionTaskName" />
        </a-col>
        <a-col :span="6">
          发布人：
          <a-input placeholder="请输入" v-model="query.publisher" />
        </a-col>
        <a-col :span="6">
          任务状态：<a-select v-model="query.status">
            <a-select-option value="已开始"> 已开始 </a-select-option>
            <a-select-option value="待开始"> 待开始 </a-select-option>
          </a-select>
        </a-col>
        <a-col :span="8">
          发布时间：
          <a-range-picker
            style="width: 330px; margin-left: 10px"
            v-model="dateRange"
            :placeholder="['开始日期', '结束日期']"
            valueFormat="YYYY-MM-DD HH:mm:ss"
            :show-time="{
              hideDisabledOptions: true,
              defaultValue: [
                moment('00:00:00', 'HH:mm:ss'),
                moment('23:59:59', 'HH:mm:ss'),
              ],
            }"
            format="YYYY-MM-DD HH:mm:ss"
            @change="onChange"
          />
        </a-col>
        <a-col :span="4">
          <a-button type="primary" @click="getQuery"> 查询 </a-button
          >&emsp;&nbsp;
          <a-button @click="cleanQuery">重置</a-button>
        </a-col>
      </a-row>
      <a-row>
        <a-tabs @change="changeTabs" v-model="activeKey">
          <a-tab-pane key="1" tab="日常任务">
            <a-col :span="4">日常任务列表</a-col>
            <a-col :span="18"></a-col>
            <a-col :span="2">
              <a-button
                type="primary"
                @click="addData"
                v-hasPermi="['yichan:yichanjc:add']"
              >
                新建
              </a-button>
            </a-col>
            <a-col :span="24">
              <a-spin :spinning="tableLoading">
                <a-table
                  :columns="columns"
                  :data-source="data"
                  :rowKey="
                    (record, index) => {
                      return index;
                    }
                  "
                  :pagination="false"
                >
                  <span slot="text" slot-scope="text, record">
                    {{ text == 0 ? "单次" : text == 1 ? "多次" : "周期" }}
                  </span>
                  <span slot="action" slot-scope="text, record">
                    <a
                      @click="lookData(record, 0)"
                      v-hasPermi="['yichan:yichanjc:view']"
                      >查看列表</a
                    >&nbsp;
                    <a
                      @click="upTable(record)"
                      v-hasPermi="['yichan:yichanjc:report']"
                      >上报</a
                    >&nbsp;
                  </span>
                </a-table>
                <a-locale-provider :locale="$zhCN">
                  <a-pagination
                    style="float: right; margin-top: 10px"
                    v-model="query.offset"
                    show-size-changer
                    :total="total"
                    :page-size-options="pageSizeOptions"
                    :page-size="query.current"
                    @change="pageChange"
                    :show-total="(total) => `共 ${total} 条`"
                    @showSizeChange="pageSizeChange"
                  />
                </a-locale-provider>
              </a-spin>
            </a-col>
          </a-tab-pane>
          <a-tab-pane key="2" tab="专项行动">
            <a-col :span="4">专项行动列表</a-col>
            <a-col :span="18"></a-col>
            <a-col :span="2">
              <a-button
                type="primary"
                @click="addData"
                v-hasPermi="['yichan:yichanjc:add']"
              >
                新建
              </a-button>
            </a-col>
            <a-col :span="24">
              <a-spin :spinning="tableLoading">
                <a-table
                  :columns="columns"
                  :data-source="data"
                  :rowKey="
                    (record, index) => {
                      return index;
                    }
                  "
                  :pagination="false"
                >
                  <span></span>
                  <span slot="action" slot-scope="text, record">
                    <a
                      @click="lookData(record, 1)"
                      v-hasPermi="['yichan:yichanjc:view']"
                      >查看列表</a
                    >&nbsp;
                    <a
                      @click="upTable(record)"
                      v-hasPermi="['yichan:yichanjc:report']"
                      >上报</a
                    >&nbsp;
                  </span>
                </a-table>
              </a-spin>
              <a-locale-provider :locale="$zhCN">
                <a-pagination
                  style="float: right; margin-top: 10px"
                  v-model="query.offset"
                  show-size-changer
                  :total="total"
                  :page-size-options="pageSizeOptions"
                  :page-size="query.current"
                  @change="pageChange"
                  :show-total="(total) => `共 ${total} 条`"
                  @showSizeChange="pageSizeChange"
                />
              </a-locale-provider>
            </a-col>
          </a-tab-pane>
        </a-tabs>
        <a-modal
          v-model="vis"
          width="35%"
          title="新增档案"
          ok-text="确认"
          cancel-text="取消"
          @ok="handleOk"
        >
          <a-row>
            <a-col :span="24" v-if="tabKey == 2">
              专项行动名字：<a-input
                placeholder="请输入"
                v-model="newData.specialName"
              />
            </a-col>
            <a-col :span="24">
              监测任务名称：<a-input
                placeholder="请输入"
                v-model="newData.inspectionTaskName"
              />
            </a-col>
            <a-col :span="24">
              监测片区：&emsp;&emsp;<a-select @change="selectManager">
                <a-select-option
                  v-for="item in mapList"
                  :key="item.id"
                  :value="
                    item.heritageZone +
                    '*-*' +
                    item.id +
                    '*-*' +
                    item.manager +
                    '*-*' +
                    item.userId
                  "
                >
                  {{ item.heritageZone }}
                </a-select-option>
              </a-select>
            </a-col>
            <a-col :span="24">
              监测任务人员：<a-input
                placeholder="请输入"
                v-model="newData.inspectorUserName"
                disabled
              />
            </a-col>
            <a-col :span="24">
              任务下发周期：
              <a-radio-group name="radioGroup" v-model="newData.massType">
                <a-radio :value="0"> 单次 </a-radio>
                <a-radio :value="1"> 多次 </a-radio>
                <a-radio :value="2"> 按周 </a-radio>
              </a-radio-group>
            </a-col>
            <a-col :span="24" v-if="newData.massType == 1">
              任务周期次数：<a-input-number
                placeholder="请输入"
                v-model="newData.massCount"
              />&emsp;次
            </a-col>
            <a-col :span="24" v-if="newData.massType == 2">
              任务周期次数：
              <a-select v-model="newData.massCount" style="width: 50%">
                <a-select-option :value="0"> 每日 </a-select-option>
                <a-select-option :value="-1"> 工作日 </a-select-option>
                <a-select-option :value="-2"> 周末 </a-select-option>
                <a-select-option :value="1"> 周一 </a-select-option>
                <a-select-option :value="2"> 周二 </a-select-option>
                <a-select-option :value="3"> 周三 </a-select-option>
                <a-select-option :value="4"> 周四 </a-select-option>
                <a-select-option :value="5"> 周五 </a-select-option>
                <a-select-option :value="6"> 周六 </a-select-option>
                <a-select-option :value="7"> 周日 </a-select-option>
              </a-select>
            </a-col>
            <a-col :span="24">
              发布时间：
              <a-date-picker
                placeholder="请输入"
                :locale="$locale"
                @change="
                  (date, dateString) => createTime(date, dateString, 'newData')
                "
              />
            </a-col>
            <a-col :span="24">
              任务下发提醒：
              <a-radio-group
                name="radioGroup"
                v-model="remindType"
                :default-value="0"
              >
                <a-radio :value="0"> 开启 </a-radio>
                <a-radio :value="1"> 关闭 </a-radio>
              </a-radio-group>
            </a-col>
            <a-col :span="24" v-if="remindType == 0">
              提醒时间：任务下发后&emsp;<a-input-number
                placeholder="请输入"
                v-model="newData.warnTime"
              />&emsp;小时
            </a-col>
          </a-row>
        </a-modal>
        <a-modal
          v-model="vis1"
          width="35%"
          title="上报"
          ok-text="确认"
          cancel-text="取消"
          @ok="handlesbOk"
        >
          <a-row style="padding-top: 0px">
            <a-col :span="24">
              <h3>上报人信息</h3>
            </a-col>
            <a-col :span="4"> 上报人姓名： </a-col>
            <a-col :span="20">
              <a-input placeholder="请输入" v-model="upData.reporterName" />
            </a-col>
            <a-col :span="4"> 上报人电话： </a-col>
            <a-col :span="20">
              <a-input placeholder="请输入" v-model="upData.reporterPhone" />
            </a-col>
            <a-col :span="4"> 发布时间： </a-col>
            <a-col :span="20">
              <a-date-picker
                format="YYYY-MM-DD HH:mm:ss"
                placeholder="请输入"
                @change="
                  (date, dateString) => createTime(date, dateString, 'upData-d')
                "
              />
            </a-col>
            <a-checkbox-group @change="checkbox">
              <a-checkbox value="1"> 是否公开信息 </a-checkbox>
              <a-checkbox value="2"> 是否接受回访 </a-checkbox>
            </a-checkbox-group>
            <a-col :span="24">
              <h3>巡查对象信息</h3>
            </a-col>
            <a-col :span="4"> 关联对象： </a-col>
            <a-col :span="20">
              <a-cascader
                style="width: 60%"
                :options="gloptions"
                :load-data="loadData"
                placeholder="请选择"
                change-on-select
                @change="selectGl"
              />
            </a-col>
            <a-col :span="4"> 巡查类型： </a-col>
            <a-col :span="20">
              <a-select v-model="upData.inspectionType">
                <a-select-option value="HERITAGE_PROTECTION">
                  遗产保护
                </a-select-option>
                <a-select-option value="OPERATION_ACCESS">
                  经营准入
                </a-select-option>
                <a-select-option value="CONSERVATION_DEVELOPMENT">
                  保护建设
                </a-select-option>
                <a-select-option value="LAW_ENFORCEMENT_INSPECTION">
                  执法检查
                </a-select-option>
                <a-select-option value="DATA_MAINTENANCE">
                  数据维护
                </a-select-option>
              </a-select>
            </a-col>
            <a-col :span="4"> 地图定位： </a-col>
            <a-col :span="20">
              <a-button @click="vis2 = true">地图定位</a-button>
            </a-col>
            <a-col :span="4"> 事发网格： </a-col>
            <a-col :span="20">
              <a-input
                placeholder="请输入"
                disabled
                v-model="upData.heritageZoneId"
              />
            </a-col>
            <a-col :span="4"> 责任负责人： </a-col>
            <a-col :span="20">
              <a-input placeholder="请输入" disabled />
            </a-col>
            <a-col :span="4"> 计时区域： </a-col>
            <a-col :span="20">
              <a-input
                placeholder="请输入"
                disabled
                v-model="upData.timedArea"
              />
            </a-col>
            <a-col :span="24">
              <h3>上报问题信息</h3>
            </a-col>
            <a-col :span="4"> 问题来源： </a-col>
            <a-col :span="20">
              <a-select v-model="upData.issueInfo.issueSource">
                <a-select-option value="CONVENIENCE_12345">
                  便民12345
                </a-select-option>
                <a-select-option value="CITIZEN_REPORT">
                  市民举报
                </a-select-option>
                <a-select-option value="SPECIAL_SURVEY">
                  专项普查
                </a-select-option>
                <a-select-option value="PATROL_REPORT">
                  巡査上报
                </a-select-option>
              </a-select>
            </a-col>
            <a-col :span="4"> 问题类型： </a-col>
            <a-col :span="20">
              <a-select v-model="upData.issueInfo.issueType">
                <a-select-option value="INFRASTRUCTURE_ISSUES">
                  基础设施问题
                </a-select-option>
                <a-select-option value="ENVIRONMENTAL_SANITATION_ISSUES">
                  环境卫生问题
                </a-select-option>
                <a-select-option value="SAFETY_MANAGEMENT_ISSUES">
                  安全管理问题
                </a-select-option>
                <a-select-option value="COMMERCIAL_ORDER_ISSUES">
                  商业秩序问题
                </a-select-option>
                <a-select-option value="CULTURAL_PROTECTION_ISSUES">
                  文化保护问题
                </a-select-option>
                <a-select-option value="TOURIST_SERVICES_ISSUES">
                  游客服务问题
                </a-select-option>
                <a-select-option value="ECOLOGICAL_ENVIRONMENT_ISSUES">
                  生态环境问题
                </a-select-option>
              </a-select>
            </a-col>
            <a-col :span="4"> 问题等级： </a-col>
            <a-col :span="20">
              <a-select v-model="upData.issueInfo.issueLevel">
                <a-select-option value="DAILY"> 日常 </a-select-option>
                <a-select-option value="GENERAL"> 一般 </a-select-option>
                <a-select-option value="SEVERE"> 严重 </a-select-option>
                <a-select-option value="MAJOR"> 重大 </a-select-option>
              </a-select>
            </a-col>
            <a-col :span="4"> 紧急程度： </a-col>
            <a-col :span="20">
              <a-radio-group
                v-model="upData.issueInfo.urgencyLevel"
                name="radioGroup"
                :default-value="1"
              >
                <a-radio value="GENERAL"> 一般 </a-radio>
                <a-radio value="URGENT"> 紧急 </a-radio>
              </a-radio-group>
            </a-col>
            <a-col :span="4"> 截止时间： </a-col>
            <a-col :span="20">
              <a-date-picker
                placeholder="请输入"
                format="YYYY-MM-DD HH:mm:ss"
                @change="
                  (date, dateString) =>
                    createTime(date, dateString, 'upData1-d')
                "
              />
            </a-col>
            <a-col :span="4">上传材料：</a-col>
            <a-col :span="20">
              <a-upload
                name="file"
                :before-upload="handleFileUpload"
                :file-list="fileList"
                :customRequest="submitFile"
              >
                <a-button style="margin-top: -10px">
                  <a-icon type="upload" />
                  上传文件
                </a-button>
              </a-upload>
            </a-col>
            <a-col :span="4"> 问题描述： </a-col>
            <a-col :span="20">
              <a-textarea
                v-model="upData.issueInfo.issueDescription"
                placeholder="请输入"
                :rows="4"
                style="width: 60%"
              />
            </a-col>
            <a-col :span="4"> 立结案条件： </a-col>
            <a-col :span="20">
              <a-textarea
                v-model="upData.issueInfo.closeCondition"
                placeholder="请输入"
                disabled
                :rows="4"
                style="width: 60%"
              />
            </a-col>
          </a-row>
        </a-modal>
        <a-modal
          v-model="vis2"
          width="40%"
          title="地图定位"
          ok-text="确认"
          cancel-text="取消"
          @ok="getMap"
        >
          <a-row>
            <a-col :span="24">
              <a-button type="primary" @click="openTool('markTool')">
                标点
              </a-button>
              <a-button
                style="margin-left: 10px"
                type="primary"
                @click="clearTool()"
              >
                清除
              </a-button>
            </a-col>
            <a-col :span="24">
              <div class="mapDiv">
                <tdt-map :center="center" :zoom="13">
                  <tdt-mousetool
                    ref="mousetoolRef"
                    :markTool="{ follow: true }"
                    @mark-mouseup="onMarkMouseup"
                  >
                  </tdt-mousetool>
                </tdt-map>
              </div>
            </a-col>
          </a-row>
        </a-modal>
      </a-row>
    </div>
    <div v-else>
      <a-breadcrumb style="margin-bottom: 10px">
        <a-breadcrumb-item>遗产监测平台</a-breadcrumb-item>
        <a-breadcrumb-item>遗产监测任务</a-breadcrumb-item>
        <a-breadcrumb-item>列表</a-breadcrumb-item>
      </a-breadcrumb>
      <a-row>
        <a-col :span="4">{{
          indexPage ? "专项任务列表" : "日常任务列表"
        }}</a-col>
        <a-col :span="18"></a-col>
        <a-col :span="2">
          <a-button type="primary" @click="vis3 = true"> 返回 </a-button>
        </a-col>
      </a-row>
      <a-row>
        <a-spin :spinning="loading">
          <!-- 数据表格 -->
          <div class="table-container">
            <a-table
              :columns="tableColumns"
              :data-source="tableData"
              :pagination="false"
              :row-key="(record) => record.eventId"
            >
              <!-- 操作列 -->
              <template slot="operation" slot-scope="text, record">
                <a-space>
                  <a-button type="link" @click="handleOperation(record)"
                    >案件详情
                  </a-button>
                </a-space>
              </template>
            </a-table>
          </div>

          <div class="page_box">
            <a-pagination
              v-model="pageParams.offset"
              :page-size-options="['20', '30', '40', '50']"
              :total="detailTotal"
              show-size-changer
              :page-size="pageParams.current"
              @showSizeChange="onShowSizeDetailChange"
              @change="pageDetailChange"
              :show-total="(detailTotal) => `共 ${detailTotal} 条`"
            ></a-pagination>
          </div>
        </a-spin>
      </a-row>
    </div>
  </div>
</template>
<script>
import moment from "moment";
import dictMixin from "@/mixins/dictMixin";

export default {
  mixins: [dictMixin],
  mounted() {
    // this.getMapList();
    this.getList();
  },
  data() {
    return {
      activeKey: "1",
      loading: false,
      pageParams: {
        current: 20,
        offset: 1,
      },
      detailTotal: 0,
      total: 0,
      tableLoading: false,
      dateRange: [],
      button: [],
      data: [],
      tabKey: 1,
      columns: [],
      reportColumns: [],
      tableColumns: [
        {
          title: "事件编号",
          dataIndex: "eventId",
          key: "eventId",
          width: 100,
        },
        {
          title: "问题来源",
          dataIndex: "issueSource",
          key: "issueSource",
          width: 100,

          // customRender: (text, record, index) => {
          //   return (
          //     (this.issueSourceList.find((item) => item.value == text) || {})
          //       .label || ""
          //   );
          // },
        },
        {
          title: "问题类型",
          dataIndex: "issueType",
          key: "issueType",
          width: 100,
        },
        {
          title: "紧急程度",
          dataIndex: "urgencyLevel",
          key: "urgencyLevel",
          width: 100,
          customRender: (text, record, index) => {
            return (
              (this.urgencyLevelList.find((item) => item.value == text) || {})
                .label || ""
            );
          },
        },
        {
          title: "受理状态",
          dataIndex: "businessStatus",
          key: "businessStatus",
          width: 100,
          customRender: (text, record, index) => {
            return (
              (this.businessStatusList.find((item) => item.value == text) || {})
                .label || ""
            );
          },
        },
        {
          title: "办理状态",
          dataIndex: "eventStatus",
          key: "eventStatus",
          width: 100,
          customRender: (text, record, index) => {
            return (
              (this.dealStatusList.find((item) => item.value == text) || {})
                .label || ""
            );
          },
        },
        {
          title: "关联对象",
          dataIndex: "relatedObjectName",
          key: "relatedObjectName",
          width: 100,
        },
        {
          title: "案件描述",
          dataIndex: "issueDescription",
          key: "issueDescription",
          width: 100,
        },
        {
          title: "上报人姓名",
          dataIndex: "reporterName",
          key: "reporterName",
          width: 100,
        },
        {
          title: "上报人电话",
          dataIndex: "reporterPhone",
          key: "reporterPhone",
          width: 100,
        },
        {
          title: "上报时间",
          dataIndex: "reportTime",
          key: "reportTime",
          width: 100,
        },
        {
          title: "操作",
          dataIndex: "operation",
          key: "operation",
          width: 100,
          scopedSlots: { customRender: "operation" },
        },
      ],
      vis: false,
      vis1: false,
      vis2: false,
      vis3: true,
      pageSizeOptions: ["10", "20", "50"],
      total: 0,
      query: {
        offset: 1,
        current: 20,
        isSpecial: "0",
        status: "",
      },
      upData: {
        reporterName: "",
        reporterPhone: "",
        reportTime: "",
        issueInfo: {},
        isFeedback: false,
        isPublic: false,
        relatedTasksId: "",
        timedArea: "遗产区",
      },
      mapList: [],
      newData: {
        massType: 0,
        inspectorUserName: "",
      },
      oldData: {},
      gloptions: [
        {
          value: "yichan_code",
          label: "遗产",
          isLeaf: false,
        },
        {
          value: "merchant_code",
          label: "商户",
          isLeaf: false,
        },
      ],
      center: [100.235533, 26.870553],
      zoom: 13,
      fileList: [],
      reportData: [],
      file: {},
      remindType: 1,
      indexPage: 0,
    };
  },

  methods: {
    moment,
    handleOperation(record) {
      this.$router.push({
        path: "/yichan/sjdetail",
        query: {
          id: record.eventId,
          operationType: "Detail",
          pageType: "Yichanjc",
        },
      });
    },
    onChange(val) {
      this.query.startTime = val[0];
      this.query.endTime = val[1];
    },
    openTool(toolName) {
      this.$refs.mousetoolRef.open(toolName);
    },
    clearTool(toolName) {
      toolName
        ? this.$refs.mousetoolRef.clear(toolName)
        : this.$refs.mousetoolRef.clearAll();
    },
    onMarkMouseup(e) {
      console.log(e.currentLnglat);
      this.upData.latitude = e.currentLnglat.lat.toString();
      this.upData.longitude = e.currentLnglat.lng.toString();
    },

    getMap() {
      var parmas = {
        latitude: this.upData.latitude,
        longitude: this.upData.longitude,
        relatedObjectType: this.upData.relatedObject,
      };
      this.$axios
        .post(
          "/government-platform-center/xunjian/patrolInspection/searchMap",
          parmas
        )
        .then((res) => {
          if (res.data.msg == "success") {
            this.upData.heritageZoneId = res.data.data.heritageZone;
            this.upData.manager = res.data.data.manager;
            this.vis2 = false;
          }
        });
    },

    changeTabs(e) {
      this.tabKey = e;
      this.query.offset = 1;
      this.query.current = 20;
      this.getList();
    },
    getQuery() {
      this.query.offset = 1;
      this.getList();
    },
    cleanQuery() {
      this.dateRange = [];
      this.query = {
        current: 10,
        offset: 1,
        status: "已开始",
        inspectionTaskName: "",
        startTime: "",
        endTime: "",
      };
      this.getList();
    },
    getList() {
      if (this.tabKey == 1) {
        this.query.isSpecial = "0";
        this.columns = [
          {
            title: "序号",
            dataIndex: "key",
            key: "key",
            align: "center",
            customRender: (text, record, index) => `${index + 1}`,
          },
          {
            title: "监测任务名称",
            dataIndex: "inspectionTaskName",
            key: "inspectionTaskName",
          },
          {
            title: "周期",
            dataIndex: "massType",
            key: "massType",
            scopedSlots: { customRender: "text" },
          },
          {
            title: "检测片区",
            dataIndex: "inspector",
            key: "inspector",
          },
          {
            title: "发布时间",
            dataIndex: "publishTime",
            key: "publishTime",
          },
          {
            title: "状态",
            dataIndex: "status",
            key: "status",
          },
          {
            title: "发布人",
            dataIndex: "publisher",
            key: "publisher",
          },
          {
            title: "操作",
            key: "action",
            scopedSlots: { customRender: "action" },
          },
        ];
      } else {
        this.query.isSpecial = "1";
        this.columns = [
          {
            title: "序号",
            dataIndex: "key",
            key: "key",
            align: "center",
            customRender: (text, record, index) => `${index + 1}`,
          },
          {
            title: "专项行动名称",
            dataIndex: "specialName",
            key: "specialName",
          },
          {
            title: "监测任务名称",
            dataIndex: "inspectionTaskName",
            key: "inspectionTaskName",
          },
          {
            title: "周期",
            dataIndex: "cycle",
            key: "cycle",
          },
          {
            title: "检测片区",
            dataIndex: "inspector",
            key: "inspector",
          },
          {
            title: "发布时间",
            dataIndex: "publishTime",
            key: "publishTime",
          },
          {
            title: "状态",
            dataIndex: "status",
            key: "status",
          },
          {
            title: "发布人",
            dataIndex: "publisher",
            key: "publisher",
          },
          {
            title: "操作",
            key: "action",
            scopedSlots: { customRender: "action" },
          },
        ];
      }
      var q = "government-platform-center/monitoringTasks?userId=101";
      this.tableLoading = true;
      this.$axios
        .get(q, { params: this.query })
        .then((res) => {
          if (res.data.msg == "success") {
            this.data = res.data.data;
            this.total = res.data.total;
          }
        })
        .finally(() => {
          this.tableLoading = false;
        });
      this.$axios
        .post(
          "/government-platform-center/xunjian/mini/index/getHeritageZoneList"
        )
        .then((res) => {
          if (res.data.msg == "success") {
            this.mapList = res.data.data;
            // this.total = res.data.total
          }
        });
    },
    pageChange(current) {
      this.query.offset = current;
      this.getList();
    },
    pageSizeChange(current, pageSize) {
      this.query.current = pageSize;
      this.query.offset = current;
      this.getList();
    },
    pageDetailChange(current) {
      this.pageParams.offset = current;
      this.getDetailData();
    },
    onShowSizeDetailChange(current, pageSize) {
      this.pageParams.current = pageSize;
      this.pageParams.offset = current;
      this.getDetailData();
    },
    selectGl(e) {
      console.log(e);
      if (e.length == 1) {
        this.upData.relatedObject = e[0];
      }
      if (e.length == 2) {
        var item = e[1].split(",");
        this.upData.relatedObjectId = item[0];
        this.upData.relatedObjectName = item[1];
        this.upData.relatedObjectType = item[2];
        console.log(this.upData);
      }
    },
    selectManager(e) {
      var item = e.split("*-*");
      console.log(item, "item");
      this.newData.inspector = item[0];
      this.newData.inspectorId = item[1];
      let jsonData = JSON.parse(item[2]);
      let target = jsonData[2].split("/**/");
      this.newData.inspectorUserName = target[1];
      this.newData.inspectorUserId = item[3];
    },
    loadData(selectedOptions) {
      console.log(selectedOptions, 11);
      const targetOption = selectedOptions[selectedOptions.length - 1];
      targetOption.loading = true;
      var q =
        "/government-platform-center/dictData/queryByCode?dictType=" +
        targetOption.value;
      this.$axios.get(q).then((res) => {
        if (res.data.msg == "success") {
          targetOption.loading = false;
          targetOption.children = [];
          for (let i = 0; i < res.data.data.length; i++) {
            targetOption.children.push({
              label: res.data.data[i].dictValue,
              value:
                res.data.data[i].dictId +
                "," +
                res.data.data[i].dictValue +
                "," +
                res.data.data[i].dictLabel,
            });
          }
          this.gloptions = [...this.gloptions];
        }
      });
    },
    addData() {
      this.vis = true;
    },
    upTable(record) {
      // if (this.tabKey == 1) {
      //   this.upData.relatedTasksId = record.id;
      //   this.upData.relatedTasksName = record.inspectionTaskName;
      //   this.upData.status = "1";
      // } else {
      //   this.upData.relatedActionTypeId = record.id;
      //   this.upData.relatedActionTypeName = record.inspectionTaskName;
      //   this.upData.status = "1";
      // }
      // this.vis1 = true;
      this.$router.push({
        path: "/xuncha/zhsldd/detail",
        query: {
          paramId: "",
          operationType: "Report",
          pageType: "wdsb",
        },
      });
    },
    handleOk() {
      if (this.tabKey == 1) {
        this.newData.isSpecial = "0";
      } else {
        this.newData.isSpecial = "1";
      }
      if (this.newData.massType == "0") {
        this.newData.massCount = 1;
      }
      var parmas = this.newData;
      this.$axios
        .post("government-platform-center/monitoringTasks", parmas, {
          headers: {
            "Content-Type": "application/x-www-form-urlencoded",
          },
        })
        .then((res) => {
          if (res.data.msg == "success") {
            this.getList();
            this.vis = false;
            this.newData = {};
          }
        });
    },
    handlesbOk() {
      this.$axios
        .post(
          "/government-platform-center/xunjian/patrolInspection/add",
          this.upData
        )
        .then((res) => {
          if (res.data.msg == "success") {
            this.getList();
            this.vis1 = false;
          }
        });
    },
    checkbox(e) {
      console.log(e);
      if (e) {
        for (let i = 0; i < e.length; i++) {
          if (e[i] == "1") {
            this.upData.isPublic = true;
          }
          if (e[i] == "2") {
            this.upData.isFeedback = true;
          }
        }
      }
    },
    createTime(date, dateString, sign) {
      if (sign == "newData") {
        this.newData.publishTime = dateString;
      }
      if (sign == "query") {
        this.query.entryTime = dateString;
      }
      if (sign == "upData-d") {
        this.upData.reportTime = dateString;
      }
      if (sign == "upData1-d") {
        this.upData.issueInfo.deadlineTime = dateString;
      }
    },
    deleteData(record) {
      var parmas = {
        id: record.id,
      };
      this.$axios
        .post(
          "government-platform-center/archiveManagement/deleteById",
          parmas,
          {
            headers: {
              "Content-Type": "application/x-www-form-urlencoded",
            },
          }
        )
        .then((res) => {
          if (res.data.msg == "success") {
            this.$message.success("删除成功");
            this.getList();
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    deleteData1(record) {
      var parmas = {
        id: record.eventId,
      };
      this.$axios
        .post("government-platform-center/monitoringTasks/deleteById", parmas, {
          headers: {
            "Content-Type": "application/x-www-form-urlencoded",
          },
        })
        .then((res) => {
          if (res.data.msg == "success") {
            this.$message.success("删除成功");
            this.getList();
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    handleFileUpload(event, _) {
      this.file = event;
      this.fileList.push(event);
    },
    submitFile() {
      console.log(this.file);

      const query = {
        multipartFile: this.file,
      };
      this.$axios
        .post("government-platform-center/common/uploadFile", query, {
          headers: {
            "Content-Type": "multipart/form-data",
          },
        })
        .then((response) => {
          this.$message.success("上传成功");
          this.upData.issueInfo.materialLink = response.data.data;
        });
    },
    lookData(record, index) {
      this.indexPage = index;
      this.pageParams.taskId = record.id;
      this.getDetailData();
    },
    getDetailData() {
      this.$axios
        .post(
          "/government-platform-center/monitoringTasks/queryEventByPageForSiyou",
          this.pageParams,
          {
            headers: {
              "Content-Type": "application/x-www-form-urlencoded",
            },
          }
        )
        .then((res) => {
          if (res.data.msg == "success") {
            this.tableData = res.data.data.data || [];
            this.detailTotal = res.data.data.total || 0;
            this.vis3 = false;
          } else {
          }
        });
    },
    goLink() {
      window.location.href = "http://61.166.9.9:8182/xunjian";
    },
  },
};
</script>
<style scoped>
.ant-row {
  border-radius: 5px;
  margin-bottom: 15px;
  background: #fff;
  padding: 20px;
  color: #000;
}

/deep/.ant-table-thead > tr > th {
  color: #000;
  font-weight: bold;
}

/deep/.ant-table-tbody > tr > td {
  color: #000;
}

.ant-col {
  margin: 10px 0;
}

.ant-select {
  width: 60%;
}

.ant-input {
  width: 60%;
}

.file-upload-btn {
  background-color: #007bff;
  /* 背景颜色 */
  color: white;
  /* 文本颜色 */
  border: none;
  border-radius: 5px;
  padding: 10px;
  cursor: pointer;
  font-size: 16px;
}

.mapDiv {
  width: 100%;
  height: 500px;
}
</style>
